#ifndef WSECONDSPACEAPP_H
#define WSECONDSPACEAPP_H

#include "preheader.h"

#include "wspaceview.h"
#include "zspace.h"

namespace Ui {
class WSecondSpaceApp;
}

/**
    @file wsecondspace.h
    @brief Application main window.
    @author Claus Wimmer
    @date 2014-01-04

    Project: secondspace
    Licence: LGPL (Lesser GPL)
*/
class WSecondSpaceApp : public QMainWindow {

    Q_OBJECT
    
public:

    /**
        @brief Constructor.
        @author Claus Wimmer
        @date 2012-10-05
        @param parent Parent QObject, not necessary.
    */
    explicit WSecondSpaceApp(QWidget *parent = 0);

    /**
        @brief Free mem.
        @author Claus Wimmer
        @date 2012-10-05
    */
    ~WSecondSpaceApp();

public slots:

    /**
        @brief Trigger for a new space calculation step.
        @author Claus Wimmer
        @date 2012-10-05

        Triggered by the internal timer of this class.
    */
    void timeout();

    /**
        @brief User command to run the simulation.
        @author Claus Wimmer
        @date 2012-10-05
    */
    void start();

    /**
        @brief User command to interrupt the simulation until start occurs.
        @author Claus Wimmer
        @date 2012-10-05
    */
    void stop();

    /**
        @brief User command to reset the simulation to initial values.
        @author Claus Wimmer
        @date 2012-10-05
    */
    void rewind();

    /**
        @brief Forward the slider value modified by user to zspace.h.
        @author Claus Wimmer
        @date 2012-10-05
        @param value Slider position between max and min.
    */
    void registerSliderValueChanged(int value);

    /**
        @brief Show a popup message.
        @author Claus Wimmer
        @date 2012-10-05
        @param msg Text of the message.
    */
    void showText(QString msg);

    /**
        @brief Update status message.
        @author Claus Wimmer
        @date 2013-07-16
      */
    void updateStatusText();

    /**
        @brief Rendering mode changed.
        @author Claus Wimmer
        @date 2014-01-04
      */
    void modusRadioButtonChecked();

signals:

    /**
        @brief Execute the init - kernel.
        @author Claus Wimmer
        @date 2012-10-05
    */
    void initSpace();

    /**
        @brief Execute the step - kernel.
        @author Claus Wimmer
        @date 2012-10-05
    */
    void stepSpace();

    /**
        @brief User has modified the value of the slider control.
        @author Claus Wimmer
        @date 2012-10-05
        @param value Slider position between max and min.
    */
    void sliderValueChanged(int value);

private:

    /**
        @brief Timer to trigger the space calculation steps.
        @author Claus Wimmer
        @date 2012-10-05
    */
    QTimer _timer;

    /**
        @brief Current count of calculated images.
        @author Claus Wimmer
        @date 2012-10-05
    */
    int _stepcount;

    /**
        @brief See Qt designer.
        @author Claus Wimmer
        @date 2012-10-05
    */
    Ui::WSecondSpaceApp *ui;

    /**
        @brief Space calculation class.
        @author Claus Wimmer
        @date 2012-10-05
    */
    ZSpace _space;

};
#endif // WSECONDSPACEAPP_H
